package com.imooc.controller;


import com.imooc.pojo.bo.ShopcartBO;
import com.imooc.service.ItemService;
import com.imooc.utils.IMOOCJSONResult;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Api(value = "购物车", tags = {"购物车"})
@RequestMapping("shopcart")
@RestController
public class ShopcartController {
    final static Logger logger = LoggerFactory.getLogger(ShopcartController.class);


    @Resource
    ItemService itemService;

    @GetMapping("/add")
    public IMOOCJSONResult add(@RequestParam String userId,
                               @RequestBody ShopcartBO shopcartBO,
                               HttpServletRequest request,
                               HttpServletResponse response
    ) {
        if (StringUtils.isBlank(userId)) {
            return IMOOCJSONResult.errorMsg("");
        }

        // TODO: 2021/4/16  前端用户在登录情况下，添加商品到购物车，会把购物车同步到后端redis缓存
        return IMOOCJSONResult.ok();
    }




}
